package com.zf.admin.service.Impl;

import com.zf.admin.pojo.User;
import com.zf.admin.dao.UserMapper;
import com.zf.admin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public User login(User user) throws Exception {
        User user1 = userMapper.selectByUser(user);
        return user1;
    }

    @Override
    public boolean isExist(String username) {
        User user = userMapper.selectByName(username);
        if (user != null) {
            return true;
        }
        return false;
    }

    @Override
    public void register(User user) {
        userMapper.insert(user);
    }


}
